﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using ClientMobile.SSVService;
using googlemaps;

namespace ClientMobile
{
    public partial class sms : PhoneApplicationPage
    {
        public sms()
        {
            InitializeComponent();
            
        }

      

      

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Service1SoapClient ser = new Service1SoapClient();
            Singleton s = Singleton.Instance;
            ser.envoyerMsgCompleted += new EventHandler<envoyerMsgCompletedEventArgs>(ser_envoyerMsgCompleted);
            //à regler service envoyerMsg
            ser.envoyerMsgAsync(textBox1.Text,s.Chauff.id_chauffeur);
            
        }

        void ser_envoyerMsgCompleted(object sender, envoyerMsgCompletedEventArgs e)
        {
            if (e.Result != false && textBox1.Text!="")
            {
                MessageBox.Show("message Envoyé!");
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
            else
            { MessageBox.Show("Erreur d'envoi!!"); }
        }



        private void button2_Unloaded(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
        }

      
    }
}